﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Ongoal.Quotation.Service.ViewModel.typemenu;

namespace Ongoal.Quotation.Service.ViewModel
{
    /// <summary>
    /// 菜单视图
    /// </summary>
    [Serializable]
    public class MenuView
    {
        public MenuView()
        {
            children = new List<MenuView>();
        }
        public string? path { get; set; }
        public int id { get; set; }
        public int? parentid { get; set; }
        public string? name { get; set; }
        public metaclass meta { get; set; }
        public string? redirect { get; set; }
        public bool keepAlive { get; set; } = true;
        public List<MenuView> children { get; set; }
    }

    public class typemenu
    {
        public int? MenuTypeID { get; set; }
        public List<MenuView> MenuViewS { get; set; }
    }
    /// <summary>
    /// 路由meta
    /// </summary>
    [Serializable]
    public class metaclass
    {
        public string? icon { get; set; }
        public string? title { get; set; }
        public bool i18n { get; set; }
        public int? rank { get; set; }
        public bool keepAlive { get; set; }
        public bool showParent { get; set; }
        public string? frameSrc { get; set; }
        public string? authority { get; set; }
        public int menuid { get; set; }
    }

        public class AuthorMenuTree
        {
            public AuthorMenuTree()
            {
                children = new List<AuthorMenuTree>();
            }
            /// <summary>
            /// ID
            /// </summary>
            public int ID { get; set; }
            /// <summary>
            /// 区分ID
            /// </summary>
            public string KeyID { get; set; }
            /// <summary>
            /// 父ID
            /// </summary>
            public int? ParentID { get; set; }
            /// <summary>
            /// 名称
            /// </summary>
            public string Name { get; set; }
            /// <summary>
            /// 选中
            /// </summary>

            public bool Checked { get; set; }
            /// <summary>
            /// 子节点
            /// </summary>
            /// 

            public List<AuthorMenuTree> children { get; set; }
            /// <summary>
            /// 类型
            /// </summary>
            public TreeType type { get; set; }
        }
        /// <summary>
        /// 树类型
        /// </summary>
        public enum TreeType
        {
            /// <summary>
            /// 菜单类型
            /// </summary>
            MenuType,
            /// <summary>
            /// 菜单
            /// </summary>
            Menu,
            /// <summary>
            /// 操作权限文件夹
            /// </summary>
            OperateFloder,
            /// <summary>
            /// 操作权限
            /// </summary>
            Operate,
            /// <summary>
            /// 数据权限文件夹
            /// </summary>
            DataitemFloder,
            /// <summary>
            /// 数据权限
            /// </summary>
            Dataitem


        }
        /// <summary>
        /// 权限格式化
        /// </summary>
        public class Authorformatter
        {
            public Authorformatter()
            {
                MenuList = new List<int>();
                OperateList = new List<int>();
                DataItemList = new List<int>();
            }
            /// <summary>
            /// 菜单权限
            /// </summary>
            public List<int> MenuList { get; set; }
            /// <summary>
            /// 操作权限
            /// </summary>
            public List<int> OperateList { get; set; }
            /// <summary>
            /// 数据权限
            /// </summary>
            public List<int> DataItemList { get; set; }
        }
    }

